﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace PIM_ATE
{
    public partial class FrmChangePwd : Form
    {
        public FrmChangePwd(ClsDataUser usr)
        {
            InitializeComponent();
            m_usrObj = usr;
        }

        ClsDataUser m_usrObj;

        private void FrmChangePwd_Load(object sender, EventArgs e)
        {

        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (textNew.Text != textNewConfim.Text)
            {
                MessageBox.Show("新密码不一致！");
                return;
            }

            if (m_usrObj.ChangePassword1(textUserID.Text, textOld.Text, textNew.Text))
            {
                MessageBox.Show("修改成功！");
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show(m_usrObj.sError);
                return;
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }
    }
}
